#ifndef __LEVEL_H__
#define __LEVEL_H__

#include <string>
#include <vector>
#include "move.h"

namespace AI_SOKOBAN
{
    class Level
    {
    public:
        Level(std::vector<std::string> rows, int row_count, int col_count);
        Level(const Level& level, Move move);
        Level(const Level& level);
        Level(){}
        char at(int x, int y) const;
        char at(std::pair<int,int> p) const;
        void set(std::pair<int,int> p, char c);
        void set(int x, int y, char c);
        void setPlayer(int x,int y);
        void setPlayer(std::pair<int,int> p);
        void tooglePlayer(int x, int y, bool add);
        void movePlayer(char direction);
         int hash() const;
        bool operator==(const Level& b) const;
        Level& operator=(const Level& b);
        ~Level();
        std::string findPossibleSteps();
        bool isCave(std::pair<int,int>,bool isCaveStart)const;
        bool isCave(int x, int y, bool isCaveStart)const;
        bool isCorner(int x, int y) const;
        bool isCorner(std::pair<int,int>p) const;
        int getNumberOfBoxes();
        int getNumberOfBoxesInGoals();
        int getNumberOfGoals();
        int getNumberOfX(char c);
        char* getData() const;
        int* getCompactData() const;
        //char* getStuckData() const;
        int getRows() const;
        int getCols() const;
        std::pair<int,int> getPlayer() const;
    private:
        void calcStuckData();
        std::pair<int,int> findPlayerAndRemve();
        bool calcStuckHelper_walls(int x,int y, int x2, int y2);
        void initZobrist();

        char* m_data;
        //char* m_stuckData;
        int m_cols;
        int m_rows;
        std::pair<int,int> m_player;
         int* m_zobrist;

    };
}
#endif